import { activeEffect, track, trigger } from '../effect'

// @ts-ignore
window.dep = dep

export function getBaseProxyHandler<T extends object>():ProxyHandler<T> {
  return {
    get(target, p) {
      if(activeEffect) track(target, p, activeEffect)
      return Reflect.get(target, p)        
    },

    set(target, p, newValue) {
      const result = Reflect.set(target, p, newValue)
      trigger(target, p)
      return result
    },

    defineProperty(target, property, attributes) {
      return true  
    },

    has(target, p) {
      return true  
    },
    
    ownKeys(target) {
      return []  
    },
  }
}

